using System.Data;
using Crosland.Offline.Core;
using Crosland.Framework.Base;

namespace Crosland.Offline.Data.Helper
{

    public class DatoComercialClienteHelper : DaoHelperBase
    {
        public DatoComercialClienteHelper() : base(Entidad, ConstansBase.Aplicacion) 
        {
        }

        public DatoComercialCliente Create(IDataReader dr)
        {
            DatoComercialCliente entity = new DatoComercialCliente();

            int iKunnr = dr.GetOrdinal(this.Kunnr);
            if (!dr.IsDBNull(iKunnr)) entity.ID = dr.GetString(iKunnr);

            int iVkorg = dr.GetOrdinal(this.Vkorg);
            if (!dr.IsDBNull(iVkorg)) entity.Vkorg = dr.GetString(iVkorg);

            int iVtweg = dr.GetOrdinal(this.Vtweg);
            if (!dr.IsDBNull(iVtweg)) entity.Vtweg = dr.GetString(iVtweg);

            int iSpart = dr.GetOrdinal(this.Spart);
            if (!dr.IsDBNull(iSpart)) entity.Spart = dr.GetString(iSpart);

            int iKdgrp = dr.GetOrdinal(this.Kdgrp);
            if (!dr.IsDBNull(iKdgrp)) entity.Kdgrp = dr.GetString(iKdgrp);

            int iWaers = dr.GetOrdinal(this.Waers);
            if (!dr.IsDBNull(iWaers)) entity.Waers = dr.GetString(iWaers);

            int iKonda = dr.GetOrdinal(this.Konda);
            if (!dr.IsDBNull(iKonda)) entity.Konda = dr.GetString(iKonda);

            int iPltyp = dr.GetOrdinal(this.Pltyp);
            if (!dr.IsDBNull(iPltyp)) entity.Pltyp = dr.GetString(iPltyp);

            int iTaxkd = dr.GetOrdinal(this.Taxkd);
            if (!dr.IsDBNull(iTaxkd)) entity.Taxkd = dr.GetString(iTaxkd);

            int iLvgr1 = dr.GetOrdinal(this.Lvgr1);
            if (!dr.IsDBNull(iLvgr1)) entity.Lvgr1 = dr.GetString(iLvgr1);

            int iZterm = dr.GetOrdinal(this.Zterm);
            if (!dr.IsDBNull(iZterm)) entity.Zterm = dr.GetString(iZterm);

            return entity;
        }


        #region Mapeo de Campos

        public const string Entidad = "DatoComercialCliente";
        public string Kunnr = "KUNNR";
        public string Vkorg = "VKORG";
        public string Vtweg = "VTWEG";
        public string Spart = "SPART";
        public string Kdgrp = "KDGRP";
        public string Waers = "WAERS";
        public string Konda = "KONDA";
        public string Pltyp = "PLTYP";
        public string Taxkd = "TAXKD";
        public string Lvgr1 = "LVGR1";
        public string Zterm = "ZTERM";

        #endregion
    }
}
